<?php
class V1_block extends CI_Controller{
	 function V1_block(){
	  	parent::__construct();
	  	$this->load->model('block');
	 }
	 function write(){
	 	$data['get']=$this->input->get();
	 	$clg=intval($data['get']['clg']);
	 	if($this->input->server('REQUEST_METHOD')=='POST'){
			$post=$this->input->post();$block=array();
			foreach($post as $key=>$value){
				$block['catalog']=$clg;
				$block['key']=$key;
				$block['block']=$value;
				$this->block->replace($block);
			}
	 	}
		$data['block']=$this->block->keyvalue(array('where'=>array('catalog'=>$clg)));
	 	$this->load->view('block/'.$data['get']['tpl'].'.php',$data);
	 }
}
?>